import footerTabbar from "../comm/footerTabbar.vue";
import { Image as VanImage } from "vant";
export default {
  components: {
    footerTabbar,
    VanImage
  },
  name: "",
  //import引入的组件需要注入到对象中才能使用
  data() {
    return {
      active: 0,
      chatStrId: "",
      memberDetail: {}
    };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    coursesRecord() {
      let query = {};
      if (this.fun.getKey("client") === "work" || window.localStorage.getItem("client")) {
        query = { ...this.getConfig, ...query, chat_str_id: this.chatStrId };
      }
      $http
        .post("plugin.wechat-video-courses.frontend.controller.manage.record.statistics", query, "loading")
        .then(res => {
          if (res.result === 1) {
            let data = res.data;
            this.memberDetail = data;
          } else {
            this.$dialog.alert({
              message: res.msg
            });
            // this.$toast(res.msg);
          }
        })
        .catch(err => {
          console.log("getUserData::err", err);
        });
    }
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {
  },
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {
    if(this.fun.getKey("client") === "work" || window.localStorage.getItem("client")) {
      this.chatStrId = window.localStorage.getItem("chat_id") || '';
    }
    this.coursesRecord();
  } //如果页面有keep-alive缓存功能，这个函数会触发
};
